// CStringTest.cpp : Defines the entry point for the console application.
//


#include "stdafx.h"
#include <vector>

using namespace std;

class A{
public:
	string content_;
	A (string& content) {content_ = content;};
	bool operator==(CString& right){
		cout << "\tcall operator==(CString&)" << endl;
		return right.Compare(CString(content_.c_str())) == 0;
		
		
	}
	bool operator==(CString* right){
		cout << "\tcall operator==(CString*)" << endl;
		return right->Compare(CString(content_.c_str()))  == 0;
	}	
};

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	string s("Original");
	A a(s);
	CString str1("Original");
	CString str2("Different");
	cout << "a=" << a.content_.c_str() <<  endl;
	wcout << "str1=" << str1.GetBuffer(str1.GetLength()) << endl;
	wcout << "str2=" << str2.GetBuffer(str2.GetLength()) << endl;
	cout << "Call a==str1 " << endl;
	cout << "\t" << ( a== str1?"true":"false") << endl;
	
	cout << "Call a==(&str2) "<< endl;
	cout << "\t"<< ( a == (&str2)?"true":"false") << endl;

	vector<A*> myVec;
	myVec.push_back(&a);
	vector<A*>::iterator iter = myVec.begin();

	*(*iter) == str1;
	//(*iter) == str1;
	return 0;
}
